#include "src/ltprint.h"
#include "src/ltbase.h"
#include "src/ltgen.h"

lt_UsingType(lt, USize);

typedef struct {
    char const* name;
    char const* type_name;
} PrinterInfo;

ltgen_Generator(ltprint_Print_EPrint) {
    static PrinterInfo infos[] = {
        {.name = "U32", .type_name = "lt_U32"},
        {.name = "U64", .type_name = "lt_U64"},
        {.name = "USize", .type_name = "lt_USize"},
        {.name = "Char", .type_name = "char"},
        {.name = "CharQuote", .type_name = "char"},
        {.name = "Ptr", .type_name = "void*"},
        {.name = "String", .type_name = "char const*"},
        {.name = "StringQuote", .type_name = "char const*"},
        {.name = "LtaU32", .type_name = "lta_U32Arr const*"},
        {.name = "LtaStrings", .type_name = "lta_Strings const*"},
        {.name = NULL, .type_name = NULL},
    };

    for (USize i = 0; infos[i].name != NULL; ++i) {
        char const* name = infos[i].name;
        char const* type_name = infos[i].type_name;

        printf("lt_ForceInline void\n"
               "ltprint_Print_%s(%s x) {\n"
               "    ltprint_FPrint_%s(stdout, x);\n"
               "}\n\n",
               name, type_name, name);

        printf("lt_ForceInline void\n"
               "ltprint_EPrint_%s(%s x) {\n"
               "    ltprint_FPrint_%s(stderr, x);\n"
               "}\n\n",
               name, type_name, name);
    }
    return 0;
}
